---
title: "Stock Explorer"
format:
dashboard:
theme: [yeti, custom.scss]
html-math-method: katex
code-tools: true
self-contained: true
embed-resources: true
page-layout: full
---
```{python}
#| tags: [parameters]
# to render w/ a different ticker parameter:
# quarto render dashboard.qmd -P ticker:GOOG
tickers = ["BA", "AAPL", "GOOG"]
```
```{python}
import helpers
stocks = {ticker: helpers.get_stock(ticker) for ticker in tickers}
data = {ticker: helpers.get_data(stocks[ticker]) for ticker in tickers}
```
## Row
```{python}
from IPython.display import Markdown
for ticker in tickers:
stock = helpers.get_stock(ticker)
data = helpers.get_data(stock)
change = helpers.get_change(data)
ohlc = helpers.make_OHLC_table(data)
```
## Row
```{python}
#| content: valuebox
#| title: "Current Price"
dict(
icon = "currency-dollar",
color = "secondary",
value = helpers.get_price(data)
)
```
```{python}
#| content: valuebox
#| title: "Change"
change = helpers.get_change(data)
dict(
value = change['amount'],
icon = change['icon'],
color = change['color']
)
```
```{python}
#| content: valuebox
#| title: "Percent Change"
dict(
icon = "percent",
color = "light",
value = change['percent'],
)
```
## Row
### Column {width=75%}
```{python}
#| title: Price History
#| padding: 0
helpers.make_candlestick_chart(data, ticker.upper())
```
### Column {width=25%}
```{python}
ohlc = helpers.make_OHLC_table(data)
```
::: {.card}
#### Last Close: `{python} ohlc['date']`
| Close | `{python} ohlc['close']` |
|:-------|--------------------------:|
| Open | `{python} ohlc['open']` |
| High | `{python} ohlc['high']` |
| Low | `{python} ohlc['low']` |
| Volume | `{python} ohlc['volume']` |
: {.striped}